package app.fugema.shop.main.order.vm;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import app.fugema.shop.main.order.model.OrderDetailResult;
import app.fugema.shop.main.order.model.OrderExpressResult;
import app.fugema.shop.main.order.model.OrderListResult;

import com.base.common.netBeanPackage.BaseApiResult;
import com.base.common.netBeanPackage.LiveDataWrapper;
import com.base.common.viewmodel.BaseViewModel;
import app.fugema.shop.http.HttpService;


public class OrderListVM extends BaseViewModel {

    public OrderListVM(@NonNull Application application)
    {
        super(application);
    }


    /**
     *  查询 订单列表
     * @param status
     * @param pn
     * @param ps
     * @param userKey
     * @return
     */
    public MutableLiveData<LiveDataWrapper<OrderListResult>> getMyOrders(int status, int pn, int ps, String userKey)
    {
        return send(HttpService.getHttpServer().getMyOrders(status, pn, ps,userKey));
    }

    /**
     * 订单详情信息
     * @param orderId
     * @param userKey
     * @return
     */
    public MutableLiveData<LiveDataWrapper<OrderDetailResult>> getOrderDetail(long orderId, String userKey)
    {
        return send(HttpService.getHttpServer().getOrderDetail(orderId ,userKey));
    }

    /**
     *  订单 收货
     * @param orderId
     * @param userKey
     * @return
     */
    public MutableLiveData<LiveDataWrapper<BaseApiResult>> confirmReceiptOrder(long orderId,String userKey)
    {
        return send(HttpService.getHttpServer().confirmOrder(orderId,userKey));
    }

    /**
     * 查询订单物流 信息
     * @param orderNumber
     * @param userKey
     * @return
     */
    public MutableLiveData<LiveDataWrapper<OrderExpressResult>> checkOrderExpressInfo(long orderNumber , String userKey)
    {
        return send(HttpService.getHttpServer().getExpressInfo(orderNumber,userKey));
    }

    /**
     *  关闭 订单
     * @param orderId
     * @param userKey
     * @return
     */
    public MutableLiveData<LiveDataWrapper<BaseApiResult>> closeOrder(long orderId, String userKey)
    {
        return send(HttpService.getHttpServer().closeOrder(orderId, userKey));
    }

}
